home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Almathera Ten Pack 3: CDPD 3
/
Almathera Ten on Ten - Disc 3: CDPD3.iso
/
ab20
/
unarced
/
utilities
/
shells
/
sksh
/
init
/
stuff.sksh
< prev
Wrap
Text File
|
1995-03-17
|
3KB
|
128 lines
#*************************************************************************
# This file contains functions and aliases which can be cut out and put
# in your .skshrc file. They are not included there by default, since
# many people will not want them, or will want modified versions.
# These commands should operate with SKsh version 1.7 or later.
# They are also simple skeletons which can be expanded to add features.
#
# Also, please note that these commands have not been tested extensively.
#*************************************************************************
#*************************************************************************
# This alias will remove emacs backup files by using the "qrm" function
# defined above. It could be extended to remove ".o" files, or anything
# else.
#*************************************************************************
alias clean='qrm *~'
#*************************************************************************
# Ths function insert all files in the current directory except .o
# files into the current complist. It also inserts the contents of the
# COMPLIST variable.
#*************************************************************************
function cget {
complist -e
complist -a !*.o
complist -a $COMPLIST
}
#*************************************************************************
# Aliases and functions to make zoo files a bit easier to manipulate.
# The "zmore" function
#*************************************************************************
alias zp='zoo -print'
alias zl='zoo -list'
alias zx='zoo -extract'
alias za='zoo -add'
function zmore {
local zoofile tmpfile
if [ $# -lt 2 ]
then
echo "Usage: $0 zoofile file1..."
return;
fi
if [ -f "$1" ] then zoofile="$1"; else zoofile="$1.zoo"; fi
if [ ! -f "$zoofile" ]
then
echo "$0: $zoofile not found"
return
fi
shift
tmpfile="pipe:tmp_$CLINUM.$CMDNUM"
if [ -z "$PAGER" ] then PAGER='more'; fi
srun -o "$tmpfile" $(which zoo) -print "$zoofile" $*
$PAGER "$tmpfile"
}
#*************************************************************************
# This function insert all files from a 'zoo' archive into the current
# complist. They also insert the contents of the COMPLIST variable.
#*************************************************************************
function _zadd {
shift 2 # get rid of "Archive blah.zoo"
complist -a $*
}
function zget {
local zoofile zlist
if [ -f "$1" ] then zoofile="$1"; else zoofile="$1.zoo"; fi
if [ ! -f "$zoofile" ]
then
echo "$0: $zoofile not found"
return
fi
complist -e
zlist=$(zoo lf1 "$zoofile")
_zadd $zlist
complist -a $COMPLIST
}
#*************************************************************************
# This function extracts a zoo file in its own sub-directory, then
# deletes the original
#*************************************************************************
function zxdir {
local file dname zooname
for file in $*
do
dname=$(extname -v "$file")
zooname="$dname.zoo"
if [ ! -d "$dname" ] then mkdir "$dname"; fi
mv "$zooname" "$dname"; cd "$dname"
if zoo -extract "$zooname" >nil:
then
rm "$zooname"
else
echo "Extract Failed!"
fi
cd ..
done
}